Add days to date in PHP

103

add 7 days to date php -

$date = "Mar 03, 2011";
$date = strtotime($date);
$date = strtotime("+7 day", $date);
echo date('M d, Y', $date);

php add days to date -

$start_date = "2015/03/02";  
$date = strtotime($start_date);
$date = strtotime("+7 day", $date);
echo date('Y/m/d', $date);

Add days to date in PHP -

$date = new DateTime('2020-11-24');
$date->add(new DateInterval("P9D"));

echo $date->format('Y-m-d');

adding days in datetime php -

<?php
$date = new DateTime('2016-06-06'); // Y-m-d
$date->add(new DateInterval('P30D'));
echo $date->format('Y-m-d') . "\n";
?>

Comments

Submit
0 Comments